package jk.spider.core.event.URLFound.impl;

import java.util.Set;

import jk.spider.core.SpiderController;
import jk.spider.core.event.CoreEvent;
import jk.spider.core.event.URLFound.URLFound;
import jk.spider.core.event.impl.URLFoundEvent;
import jk.spider.model.Resource;

import org.apache.log4j.Logger;

public class ListURLFound extends URLFound  {
	protected static final Logger log = Logger.getLogger(ListURLFound.class);
	protected boolean fst = false;
	public ListURLFound(String reg) {
		super(reg);
	}
	
	public ListURLFound(String reg, Set<String> filterSet) {
		super(reg, filterSet);
	}

	public boolean findUrl(URLFoundEvent event) {
		SpiderController controller = event.getController();
		Resource eventRes = event.getResource();
		String dUrl = event.getSrc();
		if(dUrl.endsWith("%7D}") || dUrl.endsWith("%7D") || dUrl.endsWith("}"))
			return false;
		if(!this.isUrlValid(dUrl)) 
			return false;
		super.findList(dUrl, eventRes, controller);
		return true;
	}

	public void initialize() {
		
	}
	@Override
	public String getUrlFoundType() {
		return CoreEvent.COREEVENT_LIST;
	}
}
